﻿#include "RealTimeMonitor.h"
#include <iostream>
#include <QTimer>
#include <QFileInfo>
#include <QDebug>
#include "AutomaticallySaveReport.h"

namespace GenerateReport
{
    RealTimeMonitor::RealTimeMonitor()
    {
        _timer = new QTimer;
        connect(_timer, SIGNAL(timeout()), this, SLOT(onTimeout()));
    }
    RealTimeMonitor::~RealTimeMonitor()
    {
        if (_timer) delete _timer;
    }
    void RealTimeMonitor::setTimeStep(int t)
    {
        _timeStep = t;
        if (_timer)
            _timer->setInterval(t);
    }
    void RealTimeMonitor::onTimeout()
    {
        GenerateReport::AutomaticallySaveReport _autoSave;
        _autoSave.AutomaticallySaveReportExcute();
    }
    void RealTimeMonitor::run()
    {
        _timer->start();
    }
    void RealTimeMonitor::stop()
    {
        _timer->stop();
    }
}
